// @require ../cpplay-m/cpplay-m.less

var tpl = require('common:components/tpl/tpl.js');
var $btn = $('#ceping-playall');
var $about = $('w-about');
var $html = $('html');

$html.on('click', '.w-list-m-all #ceping-playall', function() {
	$html.addClass('ov-hide');
	$('.w-cpplay-m').addClass('action');
}).on('click', '.w-cpplay-m .w-cpplay-m-box .w-m-top-left', function() {
	$html.removeClass('ov-hide');
	$('.w-cpplay-m').removeClass('action');
}).on('click', '.w-cpplay-m .w-cpplay-m-box .w-cpplay-m-list>li', function() {
	var $this = $(this);
	$this.toggleClass('active');
});


exports.init = function(url, data, datatype) {
	$.ajax({
		url: url,
		data: data,
		dataType: datatype,
		success: function(ok) {
			// data = ok.data
			data = {
				"jobname": "餐饮总裁\/总经理",
				"pojobname": "酒店总裁",
				"xz_post_id": "30",
				"pojob": [{
					"id": "30",
					"name": "酒店总裁",
					"paname": [{
						"id": "34",
						"name": "酒店主管"
					}, {
						"id": "36",
						"name": "司机师傅"
					}]
				}, {
					"id": "31",
					"name": "人力资源部总监",
					"paname": [{
						"id": "35",
						"name": "温泉区域经理"
					}, {
						"id": "56",
						"name": "助理"
					}]
				}, {
					"id": "33",
					"name": "店长",
					"paname": []
				}, {
					"id": "57",
					"name": "主管",
					"paname": [{
						"id": "58",
						"name": "餐饮主管"
					}]
				}, {
					"id": "65",
					"name": "前厅经理",
					"paname": [{
						"id": "66",
						"name": "前厅经理"
					}]
				}]
			};

			var html = tpl('show-all', data)

			$('body').append(html);
		}
	})
}